package com.zbcn.combootsecurity.vertify;

import org.springframework.security.web.authentication.WebAuthenticationDetails;

import javax.servlet.http.HttpServletRequest;
/**
 *  @title CustomWebAuthenticationDetails
 *  @Description 获取用户登录时携带的额外信息
 *  @author zbcn8
 *  @Date 2019/12/16 14:02
 */
public class CustomWebAuthenticationDetails extends WebAuthenticationDetails {
	private static final long serialVersionUID = 6975601077710753878L;
	private final String verifyCode;

	public CustomWebAuthenticationDetails(HttpServletRequest request) {
		super(request);
		// verifyCode为页面中验证码的name
		verifyCode = request.getParameter("verifyCode");
	}

	public String getVerifyCode() {
		return this.verifyCode;
	}
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(super.toString()).append("; VerifyCode: ").append(this.getVerifyCode());
		return sb.toString();
	}

}
